//
// Created by Administrator on 2020/7/3.
//枚举类:
//定义:语法形式 enum class 枚举类型名:底层类型{枚举值列表};
//例:
enum class Type{General,Light,Medium,Heavy};
enum class Type1:char{General,Light,Medium,Heavy};
enum class Category{General=1,Pistol,MachineGun,Cannon};

//枚举类的优势:强作用域;转换限制;可以指定底层类型;

//例子:
#include <iostream>
using namespace std;
enum class Side{Right,Left};
enum class Thing{Wrong,Right};//这里的(Right)与Side里的(Right)不冲突
int main()
{
    Side s=Side::Right;
    Thing w=Thing::Wrong;
    cout<<(s==w)<<endl;//编译错误,无法直接比较不同枚举类
    return 0;
}